reservation
HTTP method: POST
https://testgateway.altapaysecure.com/merchant/API/reservation
Call the reservation method to create a payment using the full credit card details. The payment can be made with a credit card, or a credit card token and the CVV.
Select a payment method to see the parameters relevant for that method:
Parameter |
Description |
Type |
Mandatory | Notes |
---|---|---|---|---|
terminal |
The terminal determines the payment method and currency. For more information, see AltaPay's Payment Gateway. This is the title of your terminal, found under Home > Terminal Settings in the Merchant Interface. You can use variables in the terminal parameter. For example, if you want to call My EUR Terminal, you can set the terminal parameter value to 'My {currency} Terminal', where {currency} references the value of the currency parameter. |
string |
X |
|
shop_orderid |
This is the internal ID of the order in your webshop. In most integrations, you can use the same order ID for up to four orders. |
[a-zA-Z0-9-]{1,100} |
X |
Only accepts order IDs of 50 characters or less You can only use the same shop_orderid 4 times. |
amount |
This is the payment amount. |
float |
X |
|
currency |
This is the payment currency. It must be specified in an ISO-4217 format, either using the 3-digit numeric code, or the 3-letter character code. For more information about ISO-4217 currency codes, see https://en.wikipedia.org/wiki/ISO_4217. |
[0-9]{3} or [A-Z]{3} |
X |
|
language |
The language in which the payment form is displayed. For more information about supported language codes, see Supported languages. If the language parameter is not set, the language is derived from the browser's Accept-Language HTTP header field. If none of the browser languages are supported, the default is English, en. If the language you set is not supported, an error is returned. |
[a-z]{2} |
|
|
transaction_info |
This is a one-dimensional associative array, where you can put any value that you would like to associate with the payment in the call to createPaymentRequest. |
Array Maximum 50 entries of maximum 255 characters each. |
|
|
type |
This is the authorization type. For more information, see Payment request types: |
string |
|
It is not possible to create a payment request with type=payment. If the type is set to payment, it is automatically changed to paymentAndCapture. |
sale_reconciliation_identifier |
This is the sales reconciliation identifier, used in the reconciliation CSV files you can download from the Merchant Information Interface, or by using the getCustomReport method. For more information, see getCustomReport.This parameter can only be used when the type parameter is set to paymentAndCapture. |
String{0,100} |
|
|
sale_invoice_number |
This is the invoice number for the capture. |
String{0,100} |
|
|
fraud_service |
Setting the fraud_service parameter lets you select a different fraud detection service on the payment level. |
none maxmind red test |
|
|
cookie |
This is the cookie that will be sent back to all your callback URLs. For example, if your cookie parameters are set to |
String |
|
|
payment_source |
This identifies the source of the payment. The default value is eCommerce. |
eCommerce mobi moto mail_order telephone_order |
|
|
shipping_method |
Fraud detection services can use this parameter in the fraud detection calculations. |
LowCost DesignatedByCustomer International Military NextDay Other StorePickup TwoDayService ThreeDayService |
|
|
customer_created_date |
This is the date when the customer account was first created in your shopping system. Fraud detection services use this parameter in the fraud detection calculations. |
Date (yyyy-mm-dd) |
|
|
sales_tax |
The sales tax amount. Indicates how much of the gross amount that was sales tax, e.g. VAT (UK) or Moms (DK). |
float | ||
cardnum | The credit card number (PAN) | [0-9]{11-19} | X | Only required if you are creating a transaction from a credit card, and not a token. |
emonth | The expiry month | 01-12 | X | |
eyear | The expiry year | 2000-2999 | X | |
surcharge |
The surcharge amount to apply to the payment. You can retrieve the surcharge value based on a previously completed payment or a terminal, creditcard token, and currency combination - using the calculateSurcharge method. For more information, see calculateSurcharge. |
float | ||
cvc | The CVC/CVV/CVV2/Security Code | [0-9]{3-4} | ||
credit_card_token | A credit card token previously received from a payment. | [0-9a-f]{40} | X | Only required if you are creating a transaction using a credit card token, and not a card. |
dynamic_descriptor | The description that appears on users bank statement. This is normally set on the terminal configuration but is provided here as an API parameter to overwrite the configuration when needed on a per-payment granularity. It has a unique format of {string(25)}*{string(13)} The first part of the string should represent the business name separated with a * and then an identifier. This identifier can be used as template. Valid template inputs are %orderId, %paymentId, %currency.numeric, %currency.alpha, %customer.ip, %customer.email, %customer.phone, %customer.username. An example payment with orderId=123 by a business Computers&Company could be CompCo*%orderId which would produce CompCo*123 on the customer's bank statement. Caution: The underlying value of the templated identifier is what counts towards the maximum length of 13 and if it exceeds legal values it will depend on the terminal's dynamic descriptor policy whether it will be passed to the acquirer or not. |
String (39) |
No
|
Agreement parameters
This parameters should be provided only in case the type parameter is subscription, subscriptionAndCharge or subscriptionAndReserve
Parameter | Description | Type | Mandatory |
---|---|---|---|
agreement[id] |
This is the id of the setup agreement payment. This should be provided only in case of charging verify card agreement. |
string | No |
agreement[type] |
This is the type of the agreement. In case the reservation type parameter is subscription, subscriptionAndCharge or subscriptionAndReserve and no agreement[type] is provided, it will create a recurring agreement. Possible values:
|
string | No |
agreement[unscheduled_type] |
This is the type of the unscheduled agreement. In case the reservation type parameter is subscriptionAndCharge or subscriptionAndReserve and the agreement[type]=unscheduled, the agreement[unscheduled_type] parameter is mandatory. Possible values:
|
string | No |
agreement[expiry] | This is the date when the agreement expires. It must have the format YYYYMMDD. | string | No |
agreement[frequency] | It is an integer value representing the frequency between the charge agreement requests made by the merchant. Possible values: 0 - Flexible; 1 - Daily; 7 - Weekly; 14 - Biweekly; 30 - Monthly; 90 - Quarterly; 365 - Yearly. | integer |
No Not allowed for unscheduled agreement. |
agreement[next_charge_date] | This is the date of the first charge agreement request made by the merchant. It must have the format YYYYMMDD. | string | No |
agreement[admin_url] | This is a link to a page on the merchant side where the customer can manage the agreement. |
string | No |
agreement[retention_period] | The customer will be able to cancel the agreement only after passing this retention period. |
string | No |
Customer information parameters
Parameter | Description | Type | Mandatory |
---|---|---|---|
customer_info[username] | The customer's e-user name or user id. This uniquely identifies the user in your system. | string | |
customer_info[type] | Indicator of whether the customer is an individual or a business | privatebusiness | Private is assumed if not specified |
customer_info[company_name] | Name of the customer, if the customer type is Business | string | Yes, if the customer_info[type]=business |
customer_info[company_type] | The nature of the company |
ltd - limited company plc - public limited company public_institution - public institution Other - all other company types |
Yes, if the customer_info[type]=business |
customer_info[vat_id] | The company's VAT registration number | string | Yes, if the customer_info[type]=business |
customer_info[shipping_att] | The name of the person receiving the purchase on behalf of the company | string | Used if the customer_info[type]=business; optional but recommended |
customer_info[shipping_lastname] |
The last name for the customer's shipping address. |
String | |
customer_info[shipping_firstname] |
The first name for the customer's shipping address. |
String | |
customer_info[shipping_address] |
The street address of the customer's shipping address.
See the Notes on Addresses in Klarna Payments for more details on handling addresses for KP. |
string | YesFor Norway, you can only ship to a customer's legal address |
customer_info[shipping_postal] |
The postal code of the customer's shipping address. |
string | |
customer_info[shipping_region] |
The region of the customer's shipping address. |
string | |
customer_info[shipping_country] |
The country of the customer's shipping address as a 2 character ISO-3166 country code. |
[a-zA-Z]{2} | |
customer_info[shipping_city] |
The city of the customer's shipping address. |
string | |
customer_info[shipping_ref] | A reference that can be used to track the order | string | Optional. Can be used for B2B transactions (the customer_info[type]=business) |
customer_info[email] |
The customer's email address. |
string |
Yes for all Przelewy24 transactions Yes for NO and DE |
customer_info[customer_phone] |
The customer's telephone number, without spaces. This must include the country code. You can prefix the code with + (e.g. +446721846), or 00 (e.g. 00446721846), or omit the prefix (e.g. 446721846). |
string | |
customer_info[birthdate] |
The birth date of the customer Mandatory if your MCC code is 6012. |
Date (yyyy-mm-dd) | Yes, if your MCC code is 6012 |
customer_info[billing_lastname] |
The last name for the customer's billing address. Mandatory if your MCC code is 6012. |
String |
Yes, for DK, FI, and DE. |
customer_info[billing_firstname] |
The first name for the customer's billing address. |
String |
Yes, for DK, FI, and DE |
customer_info[billing_address] |
The street address of the customer's billing address. See the Notes on Addresses in Klarna Payments for more details on handling addresses for KP.
|
string |
Yes, for DK, FI, and DE |
customer_info[billing_city] |
The city of the customer's billing address. Mandatory for fraud detection. |
string | |
customer_info[billing_region] |
The region of the customer's billing address. Mandatory for fraud detection. |
string | |
customer_info[billing_postal] |
The postal code of the customer's billing address. Mandatory if your MCC code is 6012. Mandatory for fraud detection. |
string |
Yes |
customer_info[billing_country] |
The country of the customer's billing address as a 2 character ISO-3166 country code. Northern Ireland is an exception; see here. Mandatory for fraud detection. |
[a-zA-Z]{2} |
Yes |
customer_info[billing_att] | The name of the person/role who manages the billing for the company | string | |
customer_info[billing_ref] | A reference, for example, cost center, that can be used to track the purchase order | string | Optional. Can be used for B2B transactions (the customer_info[type]=business) |
customer_info[bank_phone] |
The phone number of the bank where the credit card was issued. |
String | |
customer_info[bank_name] | string | ||
customer_info[gender] |
Certain invoice payment providers require gender to be sent. Use this field to comply with that requirement. If this parameter is required by the provider, but not set in the method call, the customer is asked for this information on the payment page (callback_form). |
FMmalefemale |
|
customer_info[client_ip] |
The customer's IP address. Used for fraud detection. |
string | |
customer_info[client_session_id] |
A unique identifier of the customers session (eg. an md5 hash of the real session id). Used for fraud detection. |
string | |
customer_info[client_accept_language] |
The language setting of the customers browser. Used for fraud detection. |
string | |
customer_info[client_user_agent] |
The customers browser identification. Used for fraud detection. |
string | |
customer_info[client_forwarded_ip] |
The customers IP address as forwarded by transparent proxy. Used for fraud detection. |
string |
Order line array parameter
Parameter | Description | Type | Mandatory |
---|---|---|---|
orderLines | The individual line items of the order. This is mandatory for some providers, and recommended for a good customer experience. | Array |
Yes
|
Order line parameters in the orderLines array
Value |
Description |
Type |
Mandatory |
---|---|---|---|
description |
Description of an item. This value is going to be used as Plan Description when initiating an agreement on MobilePay. |
String (255) |
Yes |
itemId |
The item identification. This value is going to be used as the Plan when initiating an agreement on MobilePay. The value for goodsType should be set to subscription_model Each itemId must be unique within an order. |
String (100) |
Yes |
quantity |
The quantity of the item. The value must be greater than zero. |
Decimal |
Yes |
unitPrice |
The unit price, excluding sales tax. The value must be greater than zero, unless the optional goodsType parameter is set to handling, in which case the field can be used to provide a discount. |
Decimal |
Yes |
taxPercent |
This is the tax percentage of the unit price. Send both the taxPercent and taxAmount parameters in the method call. If you provide only one, the other is inferred, and rounding errors may occur. The taxAmount is used for the calculation, and taxPercent is printed on the invoice.
|
Decimal |
No |
taxAmount |
This is the total tax on an order line, before any discounts are applied. It is recommended to use taxAmount if possible. If you provide both taxPercent and taxAmount, the amount takes precedence. Send both the taxPercent and taxAmount parameters in the method call. If you provide only one of the taxPercent and taxAmount parameters, the other parameter is inferred, and rounding errors may occur.
The taxAmount is used for the calculation, and taxPercent is printed on the invoice. |
Decimal |
Yes |
unitCode |
The relevant measurement unit for the order line. For example, kg. |
String (50) |
|
discount |
The order line's discount in percent. |
Decimal |
|
goodsType |
The goods type of the order line - shipment| handling| item| digital| discount| gift_card| info| physical| sales_tax | subscription_model |
||
imageUrl |
The full URL of the icon for the item |
String (255) |
|
productUrl | The full URL for the description of the item | String (255) |
The table shows the most pertinent response values for the method. For a complete list of API response parameters, see API Response structure (XML).
Value | Description |
---|---|
Result |
The result of the request, for example:
|
Transactions |
Contains a set of Transaction elements, each describing the relevant transactions. For more information, see Transaction. |
|
The ID of a payment or subscription. Is used for transaction processing. |
Example (based on new credit card)
An example of the form data for capturing a transaction based on a new credit card.
<form action="https://<YourShopName>.altapaysecure.com/merchant/API/H2/" method="post"> <input name="terminal" value="Terminal 1" /> <input name="shop_orderid" value="myorder123" /> <input name="amount" value="2499.95" /> <input name="currency" value="978" /> <input name="cardnum" value="4111111111111111" /> <input name="eyear" value="2014" /> <input name="emonth" value="09" /> <input name="cvc" value="123" /> <input type="submit">Submit</input> </form>
Example (based on credit card token)
An example of the form data for capturing a transaction based on a credit card token for an existing credit card.
<form action="https://<YourShopName>.altapaysecure.com/merchant/API/reservation/" method="post"> <input name="terminal" value="Terminal 1" /> <input name="shop_orderid" value="myorder123" /> <input name="amount" value="2499.95" /> <input name="currency" value="978" /> <input name="credit_card_token" value="0a4d55a8d778e5022fab701977c5d840bbc486d0" /> <input name="cvc" value="123" /> </form>
Example XML-Result
The resulting XML from a successful transaction.
<?xml version="1.0"?> <APIResponse version="20170228"> <Header> <Date>2020-09-29T12:34:56+02:00</Date> <Path>API/reservation</Path> <ErrorCode>0</ErrorCode> <ErrorMessage></ErrorMessage> </Header> <Body> <Result>Success</Result> <Transactions> <Transaction> <TransactionId>3</TransactionId> <PaymentId>ccc1479c-37f9-4962-8d2c-662d75117e9d</PaymentId> <AuthType>payment</AuthType> <CardStatus>Valid</CardStatus> <CreditCardExpiry> <Year>2028</Year> <Month>08</Month> </CreditCardExpiry> <CreditCardToken>85c1d13de7b5dceb6b739829cc27e089631b0fda</CreditCardToken> <CreditCardMaskedPan>411111******1111</CreditCardMaskedPan> <CardInformation> <IsTokenized>false</IsTokenized> <Token>hYKu5yO33OsWYfT7g4weghvPjBnb3YEZYDysb7NzAf/sHk7j5j5ejzfF2ZyhLyggcCgaNKEmjg==+1</Token> <MaskedPan>411111******1111</MaskedPan> <Expiry> <Year>2028</Year> <Month>08</Month> </Expiry> <IssuingCountry>DK</IssuingCountry> <LastFourDigits>1111</LastFourDigits> <Scheme>VISA</Scheme> </CardInformation> <ThreeDSecureResult>Not_Applicable</ThreeDSecureResult> <InvoiceOrderInfo /> <LiableForChargeback>Merchant</LiableForChargeback> <BlacklistToken>4f244dec4907eba0f6432e53b17a60ebcf51365e</BlacklistToken> <ShopOrderId>myorder123</ShopOrderId> <Shop>AltaPay Functional Test Shop</Shop> <Terminal>AltaPay Test Terminal</Terminal> <TransactionStatus>preauth</TransactionStatus> <ReasonCode>NONE</ReasonCode> <MerchantCurrency>978</MerchantCurrency> <MerchantCurrencyAlpha>EUR</MerchantCurrencyAlpha> <CardHolderCurrency>978</CardHolderCurrency> <CardHolderCurrencyAlpha>EUR</CardHolderCurrencyAlpha> <ReservedAmount>2499.95</ReservedAmount> <CapturedAmount>0</CapturedAmount> <RefundedAmount>0</RefundedAmount> <RecurringDefaultAmount>0</RecurringDefaultAmount> <CreatedDate>2010-09-28 12:34:56</CreatedDate> <UpdatedDate>2010-09-28 12:34:56</UpdatedDate> <PaymentNature>CreditCard</PaymentNature> <PaymentNatureService name="TestAcquirer"> <SupportsRefunds>true</SupportsRefunds> <SupportsRelease>true</SupportsRelease> <SupportsMultipleCaptures>true</SupportsMultipleCaptures> <SupportsMultipleRefunds>false</SupportsMultipleRefunds> </PaymentNatureService> <PaymentInfos> <PaymentInfo name="Payment_Type">payment</PaymentInfo> </PaymentInfos> <CustomerInfo/> <ReconciliationIdentifiers/> </Transaction> </Transactions> </Body> </APIResponse>
Example XML-Error (when using an unknown credit card token)
The resulting XML error when an unknown credit card token is used.
<?xml version="1.0"?> <APIResponse version="20170228"> <Header> <Date>2020-02-12T21:45:52+01:00</Date> <Path>API/reservation</Path> <ErrorCode>762813994</ErrorCode> <ErrorMessage>No credit card with selected token exists: 0a4d55a8d778e5022fab701977c5d840bbc486d0</ErrorMessage> </Header> <Body/> </APIResponse>
Use the following to test credit card transactions.
API method | Scenario | Type | Trigger amount | Trigger card number |
---|---|---|---|---|
|
The reservation fails at the 3D Secure verification attempt. |
3DSecureFail | 4.66 |
|
|
The reservation returns a technical error at the 3D Secure verification attempt. |
3DSecureError | 4.67 |
|
|
The reservation succeeds after a successful 3D Secure verification. |
3DSecureWork | 4.68 |
|
API method | Scenario | Type | Trigger amount | Trigger card number |
---|---|---|---|---|
|
The payment fails because it is declined by the bank. |
Failed | 5.66 |
|
|
The payment fails because of a technical error. |
Error | 5.67 |
|
|
The reservation succeeds after a successful 3D Secure verification. |
3DSecureWork | 5.68 |
|
|
The CVV code is correct. |
CVV Check Matched | 5.71 |
|
|
The CVV code is not correct. |
CVV Check MisMatched | 5.72 |
|
|
The CVV code is not applicable. |
CVV Check Not_Applicable | 5.73 |
|
|
The card verification fails because the card is declined. |
Failed | 16.66 |
|
|
The card verification fails because of a technical error. |
Error | 16.67 |
|
Use this test case data to test fraud check responses.
API method | Scenario | Error type | Amount | Card Number |
---|---|---|---|---|
|
Fraud check Accept | Accept | 101 |
|
|
Fraud check Challenge. | Challenge | 102 |
|
|
Fraud check Deny. | Deny |
110 |
|
|
Fraud check Unknown. | Unknown | Not possible |
|
If a payment was reserved, you can
- capture it using the captureReservation method.
- release it using the releaseReservation method.
If a payment was reserved and captured, you can:
- refund it using the refundCapturedReservation method.
If you created a subscription, you can:
- charge the subscription using the chargeSubscription method.
- reserve the subscription charge using the reserveSubscriptionCharge method.